<?php

namespace Part14_ObserverMode\Code1;


class StockObserver
{
    // 同事名称
    private $name;
    // 绑定监听的前台
    private $sub;

    public function __construct($name, $sub)
    {
        $this->name = $name;
        $this->sub = $sub;
    }

    public function update()
    {
        echo "{$this->sub->getAction()} $this->name 关闭股票行情，继续工作\n";
    }
}